//
//  ComposeTextView.swift
//  SwiftWB
//
//  Created by 钟清 on 17/4/10.
//  Copyright © 2017年 Zhong Qing. All rights reserved.
//

import UIKit
import SnapKit

class ComposeTextView: ZQKeyboardTextView, UITextViewDelegate {
    // MARK: - Life
    override init(frame: CGRect, textContainer: NSTextContainer?) {
        super.init(frame: frame, textContainer: textContainer)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        setupUI()
    }
    
    /*
    deinit {
        NSNotificationCenter.defaultCenter().removeObserver(self)
    }
    */
    
    // MARK: - 内部控制方法
    private func setupUI() {
        addSubview(placeholderLabel)
        placeholderLabel.snp_makeConstraints { (make) in
            make.left.equalTo(4)
            make.top.equalTo(8)
        }
        
        /*
        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ComposeTextView.textChange), name: UITextViewTextDidChangeNotification, object: self)
        */
    }
    
    /*
    @objc private func textChange() {
        placeholderLabel.hidden = hasText()
        ZQLog(placeholderLabel.text)
    }
    */
    
    // MARK: - Lazy
    lazy var placeholderLabel: UILabel = {
        let lb = UILabel()
        lb.textColor = UIColor.lightGrayColor()
        lb.text = "分享新鲜事..."
        lb.font = self.font
        return lb
    }()
    
    
}
